import * as React from 'react';
import './App.less';
import {Button} from 'antd';
import {observer} from 'mobx-react'
import {autorun} from 'mobx'
import CalcStore from "./CalcStore";

@observer
class App extends React.Component<{store: CalcStore}, {}> {
    constructor(props: any) {
        super(props);
        autorun(()=>console.log(this.props.store.counter));
    }

    render() {
        let {store} = this.props;
        return (
            <div className="App">
                <Button type="primary" onClick={store.inc}>+</Button>
                {store.counter}
                <Button type="primary" onClick={store.dec}>-</Button>
            </div>
        );
    }
}

export default App;
